<?php
namespace BP\Sys;

use BP\En\EntitiesNoName;

class SFDBSrcs extends EntitiesNoName {
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public function getNewEntity () 
	{
		return SFDBSrc::constructor__();
	}
	public function RetrieveAll () 
	{
		$i = $this->RetrieveAllFromDBSource();
		if (($i == 0))
		{
			$src = SFDBSrc::constructor__();
			$src->setNo("local");
			$src->setName("应用系统主数据库(默认)");
			$src->Insert();
			$this->AddEntity($src);
			return 1;
		}
		return $i;
	}
	public function RetrieveDBSrc () 
	{
		$qo = new QueryObject($this);
		$qo->AddWhere(SFDBSrcAttr::$DBSrcType, " < ", 100);
		$i = $qo->DoQuery();
		if (($i == 0))
		{
			return $this->RetrieveAll();
		}
		return $i;
	}
	public function RetrieveWCSrc () 
	{
		$qo = new QueryObject($this);
		$qo->AddWhere(SFDBSrcAttr::$DBSrcType, "= ", DBSrcType::$WebServices->getValue());
		$i = $qo->DoQuery();
		if (($i == 0))
		{
			return $this->RetrieveAll();
		}
		return $i;
	}
	public function ToJavaList () 
	{
		return $this;
	}
	public function Tolist () 
	{
		$list = [];// 
		for ($i = 0; ($i < $this->size()); ++$i) 
		{
			$list->add($this->get($i));
		}
		return $list;
	}
}
?>
